package com.weight.system.order.service.impl;

import com.weight.system.order.PO.OrderInfo;
import com.weight.system.order.service.OrderInfoService;
import com.weight.system.order.DAO.OrderInfoMapper;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import org.springframework.transaction.annotation.Transactional;
import com.weight.common.util.CommonUtils;
import lombok.extern.slf4j.Slf4j;

/**
 * 命令记录表
 */
@Service
@Transactional
@Slf4j
public class OrderInfoServiceImpl implements OrderInfoService {

	@Autowired
	private OrderInfoMapper orderInfoMapper;


	/**
	 * 查询命令记录信息--条件查询
	 * @param map
	 * @return
	 */
	@Override
	public List<OrderInfo> findOrderInfoByT(Map map){
		return orderInfoMapper.findOrderInfoByT(map);
	}

	/**
	 * 查询命令记录信息--条件，分页查询
	 * @param currentPage
	 * @param pageSize
	 * @param map
	 * @return
	 */
	@Override
	public List<OrderInfo> findOrderInfoByPage(int currentPage,int pageSize,Map map){
		PageHelper.startPage(currentPage, pageSize);
		List<OrderInfo> orderInfoList = orderInfoMapper.findOrderInfoByT(map);
		return orderInfoList;
	}

	/**
	 * 查询命令记录信息--查询全部
	 * @return
	 */
	@Override
	public List<OrderInfo> findAll(){
		return orderInfoMapper.findAll();
	}

	/**
	 * ID查询命令记录信息
	 * @param map
	 * @return
	 */
	@Override
	public OrderInfo findByOrderInfoId(Map map){
		OrderInfo orderInfo=orderInfoMapper.findByOrderInfoId(map);
		CommonUtils.validateExistObj(orderInfo,map);
		return orderInfo;
	}

	/**
	 * ID查询命令记录信息-批量
	 * @param orderInfoIdList
	 * @return
	 */
	@Override
	public List findByOrderInfoIdList(List orderInfoIdList){
		List idList = orderInfoMapper.findByOrderInfoIdList(orderInfoIdList);
		CommonUtils.validateExistList(idList,orderInfoIdList);
		return idList;
	}

	/**
	 * 添加命令记录
	 * @param orderInfo
	 */
	@Override
	public void insertOrderInfo(OrderInfo orderInfo){
		orderInfoMapper.insertOrderInfo(orderInfo);
	}

	/**
	 * 批量添加命令记录
	 * @param orderInfoList
	 */
	@Override
	public void insertOrderInfoBatch(List<OrderInfo> orderInfoList){
		orderInfoMapper.insertOrderInfoBatch(orderInfoList);
	}

	/**
	 * 修改命令记录
	 * @param orderInfo
	 */
	@Override
	public void updateOrderInfo(OrderInfo orderInfo){
		orderInfoMapper.updateOrderInfo(orderInfo);
	}

	/**
	 * 修改命令记录
	 * @param orderInfo
	 */
	@Override
	public void updateOrderInfoLimt(OrderInfo orderInfo){
		orderInfoMapper.updateOrderInfoLimt(orderInfo);
	}

	/**
	 * 物理删除命令记录
	 * @param map
	 */
	@Override
	public void deleteByOrderInfoId(Map map){
		orderInfoMapper.deleteByOrderInfoId(map);
	}

	/**
	 * 批量物理删除命令记录
	 * @param orderInfoIdList
	 */
	@Override
	public void deleteByOrderInfoIdBatch(List orderInfoIdList){
		orderInfoMapper.deleteByOrderInfoIdBatch(orderInfoIdList);
	}

	/**
	 * 状态删除命令记录
	 * @param map
	 */
	@Override
	public void upDelByOrderInfoId(Map map){
		orderInfoMapper.upDelByOrderInfoId(map);
	}

	/**
	 * 批量状态删除命令记录
	 * @param orderInfoList
	 */
	@Override
	public void upDelByOrderInfoIdBatch(Map<String, Object> map){
		orderInfoMapper.upDelByOrderInfoIdBatch(map);
	}

}